gtkstylecontext: Don't try to emit a signal when finalizing
authorJasper St. Pierre <jstpierre@mecheye.net>
Mon, 29 Dec 2014 02:11:49 +0000 (18:11 -0800)
committerJasper St. Pierre <jstpierre@mecheye.net>
Mon, 29 Dec 2014 02:13:34 +0000 (18:13 -0800)
gtk/gtkstylecontext.c

index 77739972ec433ea5214efa32498e5a3512f527f5..fcc127013e92d7467368ab071acdce542303d161 100644 (file)
@@ -522,6 +522,18 @@ _gtk_style_context_update_animating (GtkStyleContext *context)
     gtk_style_context_stop_animating (context);
 }
 
+static void
+gtk_style_context_clear_parent (GtkStyleContext *context)
+{
+  GtkStyleContextPrivate *priv = context->priv;
+
+  if (priv->parent)
+    {
+      priv->parent->priv->children = g_slist_remove (priv->parent->priv->children, context);
+      g_object_unref (priv->parent);
+    }
+}
+
 static void
 gtk_style_context_finalize (GObject *object)
 {
@@ -536,7 +548,7 @@ gtk_style_context_finalize (GObject *object)
   /* children hold a reference to us */
   g_assert (priv->children == NULL);
 
-  gtk_style_context_set_parent (style_context, NULL);
+  gtk_style_context_clear_parent (style_context);
 
   gtk_style_context_set_cascade (style_context, NULL);
 
@@ -1397,11 +1409,7 @@ gtk_style_context_set_parent (GtkStyleContext *context,
         gtk_style_context_set_invalid (parent, TRUE);
     }
 
-  if (priv->parent)
-    {
-      priv->parent->priv->children = g_slist_remove (priv->parent->priv->children, context);
-      g_object_unref (priv->parent);
-    }
+  gtk_style_context_clear_parent (context);
 
   priv->parent = parent;